//
//  HTTruckLengthTypeCell.m
//  TruckDriver
//
//  Created by Ting Han on 2017/10/19.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import "HTTruckLengthTypeCell.h"

@interface HTTruckLengthTypeCell()
@property (weak, nonatomic) IBOutlet UIView *backView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@end

@implementation HTTruckLengthTypeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _isChosed = NO;
    self.backView.layer.masksToBounds = YES;
    self.backView.layer.cornerRadius = kWidth(4);
}
- (void)setTruckModel:(HTTruckTypeModel *)truckModel{
    _truckModel = truckModel;
    self.titleLabel.text = truckModel.title;
    if (truckModel.truckTypeModelType == TruckTypeModelTypeUnlimited) {
        if (truckModel.isSelected) {
            self.isChosed = YES;
        }else{
            self.isChosed = NO;
        }
    }else{
        if (truckModel.isSelected) {
            self.isChosed = YES;
        }else{
            self.isChosed = NO;
        }
    }
}
- (void)setIsChosed:(BOOL)isChosed{
    _isChosed = isChosed;
    self.truckModel.isSelected = isChosed;
    if (isChosed) {
        self.backView.backgroundColor = kBlueColor;
        self.titleLabel.textColor = [UIColor whiteColor];
    }else{
        self.backView.backgroundColor = kBackgroundColor;
        self.titleLabel.textColor = [UIColor blackColor];
    }
}
@end
